Fraudulent Transactions Prediction

Solution Engineering - R

Felix Erlacher, Merve Taskaya, Tomasz Wlodarski

May 14, 2023

Einleitung

Features 1

  • step - maps a unit of time in the real world. In this case 1 step is 1 hour of time. Total steps 744 (30 days simulation).

  • type - CASH-IN, CASH-OUT, DEBIT, PAYMENT and TRANSFER.

  • amount - amount of the transaction in local currency.

  • nameOrig - customer who started the transaction

  • oldbalanceOrg - initial balance before the transaction

  • newbalanceOrig - new balance after the transaction

  • nameDest - customer who is the recipient of the transaction

  • oldbalanceDest - initial balance recipient before the transaction. Note that there is not information for customers that start with M (Merchants).

  • newbalanceDest - new balance recipient after the transaction. Note that there is not information for customers that start with M (Merchants).

  • isFraud - This is the transactions made by the fraudulent agents inside the simulation. In this specific dataset the fraudulent behavior of the agents aims to profit by taking control or customers accounts and try to empty the funds by transferring to another account and then cashing out of the system.

  • isFlaggedFraud - The business model aims to control massive transfers from one account to another and flags illegal attempts. An illegal attempt in this dataset is an attempt to transfer more than 200.000 in a single transaction.

Explorative Datenanalyse

Daten einlesen

#read csv data/Fraud.csv into tibble with readr::read_csv for better performance & tidyverse support
fraud <- readr::read_csv ("data/Fraud.csv", )
fraud %>% glimpse()
Rows: 6,362,620
Columns: 11
$ step           <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ type           <chr> "PAYMENT", "PAYMENT", "TRANSFER", "CASH_OUT", "PAYMENT"…
$ amount         <dbl> 9839.64, 1864.28, 181.00, 181.00, 11668.14, 7817.71, 71…
$ nameOrig       <chr> "C1231006815", "C1666544295", "C1305486145", "C84008367…
$ oldbalanceOrg  <dbl> 170136.0, 21249.0, 181.0, 181.0, 41554.0, 53860.0, 1831…
$ newbalanceOrig <dbl> 160296.36, 19384.72, 0.00, 0.00, 29885.86, 46042.29, 17…
$ nameDest       <chr> "M1979787155", "M2044282225", "C553264065", "C38997010"…
$ oldbalanceDest <dbl> 0, 0, 0, 21182, 0, 0, 0, 0, 0, 41898, 10845, 0, 0, 0, 0…
$ newbalanceDest <dbl> 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 4…
$ isFraud        <dbl> 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ isFlaggedFraud <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
introduce(fraud) %>% t()
                           [,1]
rows                    6362620
columns                      11
discrete_columns              3
continuous_columns            8
all_missing_columns           0
total_missing_values          0
complete_rows           6362620
total_observations     69988820
memory_usage         1140722824

Data Exploration

Überblick

Verteilung ausgewählter Features

Verteilung ausgewählter Features nach isFraud

Verteilung ausgewählter Features nach type

Verteilung ausgewählter Features in Zahlen

fraud %>% count(isFlaggedFraud, isFraud) %>% kable()
isFlaggedFraud isFraud n
0 0 6354407
0 1 8197
1 1 16

Korrelation